package com.jiajia;

import java.util.ArrayList;
import java.util.Random;

/**
 *
 * OutOfMemory  : the heap space
 *
 *      -Xms600m -Xmx600m
 * @author : zjj
 * @date : 2022/4/29 17:32
 */
public class Demo05OutOfMemory {

    public static void main(String[] args) {
        ArrayList<Picture> list = new ArrayList<>();
        while (true){
            try{
                Thread.sleep(20);
            }catch (Exception e){
                e.printStackTrace();
            }
            list.add(new Picture(new Random().nextInt(1024 * 1024)));
        }
    }
}
class Picture{
    private byte[] pixels;

    public Picture(int length) {
        this.pixels = new byte[length];
    }
}

